import {CHANGE_INPUT,ADD_ITEM,DEL_ITEM,GET_LIST,GET_MY_LIST} from './actionTypes'
import axios from 'axios'

export const changeInputAction = (value)=>({
    type:CHANGE_INPUT,
    value:value
})

export const  addItemAction =(value)=>({
    type:ADD_ITEM,
    value:value
})

export const delItemAction = (value)=>({
    type:DEL_ITEM,
    value:value
})

export const getList = (data)=>({
    type:GET_LIST,
    value:data
})

//redux-thunk

export const getTodoList = ()=>{
    return (dispatch)=>{
        axios.get('http://rap2api.taobao.org/app/mock/292931/index').then(res=>{
            const action = getList(res.data.list)
            dispatch(action)
        })
    }
}

//saga

export const getMyListAction = ()=>(
    {type:GET_MY_LIST,
    })